/*
 * @Author: gmh
 * @Date: 2024-02-21 09:33:27
 * @Description: 登录接口
 */
import type { LoginResult } from '@/types/member'
import { http } from '@/utils/http'

/**
 * @description: 登录请求参数类型
 */
type LoginParams = {
  code: string
  encryptedData: string
  iv: string
}

/**
 * @description: 小程序登录
 * @param {LoginParams} data
 */
export const postLoginWxMinAPI = (data: LoginParams) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

/**
 * @description: 小程序登录_内测
 * @param {string} phoneNumber 模拟手机号码
 */
export const postLoginWxMinSimpleAPI = (phoneNumber: string) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin/simple',
    data: { phoneNumber },
  })
}
